extends "../shenghei-2/shenghei-2.gd"

func _extInit():
	._extInit()
	lv = 3             #等级的设置
	addSkill("身后2格的友方单位免受所有非特效伤害(身后持续判定)", "安全领域")
	
func _upS():
	._upS()
	var index = -1
	if team == 2:index = 1

	var cha = matCha(cell + Vector2(index, 0))
	if cha != null and cha.team == team and cha.hasBuff("b_shengHei3") == null and cha != self:
		cha.addBuff(b_shengHei3.new(2))
	cha = matCha(cell + Vector2(index*2, 0))
	if cha != null and cha.team == team and cha.hasBuff("b_shengHei3") == null and cha != self:
		cha.addBuff(b_shengHei3.new(2))	

class b_shengHei3:
	extends "../../../azurlane_ctrl/AzurBuff.gd"
	func _init(lv = 1):
		attInit()
		life = lv
		id = "b_shengHei"
		buffName = "安全领域"
		dispel = 2
	func _connect():
		masCha.connect("onHurt",self,"_onHurt")
	func _onHurt(atkInfo:AtkInfo):
		if atkInfo.hurtVal > 0 and atkInfo.atkType != sys.AtkType.EFF:
			atkInfo.virtual = true
	func _upS():
		life = min(10, life)	